// pages/login/login.js
Page({
  data: {

  },
  scan: function () {
    wx.scanCode({
      success: (res) => {
        getApp().globalData.connectCode = res.result;
        wx.request({
          url: getApp().globalData.serverHost + '/connect/getTokenByConnectCode/' + res.result,
          method: 'GET',
          success: function (res) {
            if (res.data.code == 0) {
              var token = res.data.result;
              getApp().globalData.token = token;
              wx.redirectTo({
                url: '/pages/index/index'
              });
            }
          }
        })
      }
    });
  }
})